#include "multicast_sender.hpp"
#include "broadcast_sender.hpp"
#include <iostream>
#include <vector>

void test_multicast_sender()
{
    std::cout << "Testing MulticastSender..." << std::endl;
    MulticastSender sender;
    if (!sender.init("239.0.0.1", 5555))
    {
        std::cerr << "Failed to initialize MulticastSender" << std::endl;
        return;
    }

    std::vector<uint8_t> data = {'H', 'e', 'l', 'l', 'o', '!'};
    if (!sender.send(data))
    {
        std::cerr << "Failed to send multicast data" << std::endl;
    }
    else
    {
        std::cout << "Multicast data sent successfully" << std::endl;
    }

    sender.release();
}

void test_broadcast_sender()
{
    std::cout << "Testing BroadcastSender..." << std::endl;
    BroadcastSender sender;
    if (!sender.init(5555))
    {
        std::cerr << "Failed to initialize BroadcastSender" << std::endl;
        return;
    }

    std::vector<uint8_t> data = {'H', 'e', 'l', 'l', 'o', '!'};
    if (!sender.send(data))
    {
        std::cerr << "Failed to send broadcast data" << std::endl;
    }
    else
    {
        std::cout << "Broadcast data sent successfully" << std::endl;
    }

    sender.release();
}

int main()
{
    test_multicast_sender();
    test_broadcast_sender();
    return 0;
}